package com.lee.springcloud.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Lee
 * @createDate 2022/1/5 11:43
 */
@Component
/**
 * value  服务提供者地址
 * fallback  将异常、宕机、超时问题交给PaymentFallbackService这个类处理
 */
@FeignClient(value = "CLOUD-PROVIDER-HYSTRIX-PAYMENT",fallback = PaymentFallbackService.class)
public interface PaymentHystrixService {

    @GetMapping(value = "/payment/hystrix/ok/{id}")
    @ResponseBody
    String paymentInfo_OK(@PathVariable("id") Integer id);

    @GetMapping(value = "/payment/hystrix/timeout/{id}")
    @ResponseBody
    String paymentInfo_Timeout(@PathVariable("id") Integer id);
}
